<%@ page contentType="text/html; charset=utf-8" language="java"    pageEncoding="UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <title>蛋糕后台</title>
		<script type="text/javascript" src="js/jquery-1.4.2.min.js"></script>
		<script type="text/javascript">
		function del(id){
			if (!confirm("确定删除吗？")){
				return false;
		    }
			jQuery.post("delBreadPic",{id:id,r:Math.random()},function(json){
				if(json.success==1){
					 alert('操作成功');
					 location.href="uploadPic?id=${bread.id}";
				}else{
					 alert('失败了，稍后重试');
				}
			},"json");
		}
		</script>
		<style type="text/css">
			<!--
			body,td,th {
				font-family: 宋体;
				font-size: 12px;
				color: #333333;
			}
			body {
				margin-left: 0px;
				margin-top: 0px;
			}
			-->
		</style>
    </head>
    <body>
    	<form action="doUploadFile" method="post" enctype="multipart/form-data">
	        <table width="100%" border="1">
	        	<tr>
	        		<td bgcolor="#84FF84">蛋糕名称:${bread.name}</td>
	        		<td bgcolor="#84FF84">蛋糕编号:${bread.code}</td>
	        	</tr>
	        	<tr>
	        		<td bgcolor="#84FF84" colspan="2">上传类型:
		        		<select id="picType" name="picType">
		        			<option value="1">小图(210*160)</option>
		        			<option value="2">大图(400*300)</option>
		        			<option value="3">详细配图(780*530)</option>
		        		</select>
	        		</td>
	        	</tr>
	        	<tr>
	        		<td bgcolor="#84FF84" colspan="2">上传:<input type="file" name="file1" readonly="readonly"/></td>
	        	</tr>
	        	<tr>
	        		<td bgcolor="#84FF84" colspan="2">
	        		<input type="hidden" name="breadId" value="${bread.id }" />
	        		<input type="submit" name="submit" value="上传文件"/>
	        		</td>
	        	</tr>
	        </table>
        </form>
        
         <table width="100%" border="1" style="margin-top: 50px;">
        	<tr>
        		<td bgcolor="#84FF84">名称</td>
        		<td bgcolor="#84FF84">图</td>
        		<td bgcolor="#84FF84">创建时间</td>
        		<td bgcolor="#84FF84">操作</td>
        	</tr>
        	<c:forEach items="${breadPics }" var="breadPic">
	        	<tr>
	        		<td bgcolor="#84FF84">${breadPic.name}</td>
	        		<td bgcolor="#84FF84"><img src="images/${breadPic.picUrl }" width="200" height="100" /></td>
	        		<td bgcolor="#84FF84">${breadPic.createTime }</td>
	        		<td bgcolor="#84FF84">
	        			<a href="javascript:del('${breadPic.id }')">删除</a>
					</td>
	        	</tr>
        	</c:forEach>
        	<tr>
	        		<td height="40"  align="center" colspan="20"><a href="admin_base">点此返回</a></td>
	        </tr>
        </table>
        
    </body>
</html>
